﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using WFNetLib;

namespace 无线打分网站.webAPI
{
    public partial class API_ChangePassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            JSON_SubmitData SD = new JSON_SubmitData();
            SD.success = false;
            try
            {
                string id, oldpass,newpass;
                id = Request.QueryString["id"];
                oldpass = Request.QueryString["oldpass"];
                newpass = Request.QueryString["newpass"];
                MembershipUser user = Membership.GetUser(new Guid(id));
                if (user.ChangePassword(oldpass, newpass))//帐户正确
                {
                    SD.success=true;
                }
                else
                {
                    SD.message = "帐户信息不正确";
                }
            }
            catch (Exception ex)
            {
                SD.message = "未知错误" + ex.Message;
            }
            Response.Write(JsonSerializeHelper.Serialize(SD));
        }
    }
}